<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://example.com" xmlns:ex="http://example.com"
    xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:xs="http://www.w3.org/2001/XMLSchema"
    elementFormDefault="qualified" attributeFormDefault="unqualified"
    version="1.0">

    <xs:import namespace="http://www.opengis.net/gml/3.2"
        schemaLocation="http://schemas.opengis.net/gml/3.2.1/gml.xsd" />

    <!-- elements -->
    <xs:element name="ConnectionUsageParent" type="ex:ConnectionUsageParentType"
        substitutionGroup="gml:AbstractFeature" />
    <xs:element name="ConnectionUsageFirstNested" type="ex:ConnectionUsageFirstNestedType"
        substitutionGroup="gml:AbstractFeature" />
    <xs:element name="ConnectionUsageSecondNested" type="ex:ConnectionUsageSecondNestedType"
        substitutionGroup="gml:AbstractFeature" />
    <xs:element name="ConnectionUsageThirdNested" type="ex:ConnectionUsageThirdNestedType"
        substitutionGroup="gml:AbstractFeature" />

    <xs:complexType name="ConnectionUsageParentType"
        xmlns:xs="http://www.w3.org/2001/XMLSchema">
        <xs:complexContent>
            <xs:extension base="gml:AbstractFeatureType">
                <xs:sequence>
                    <xs:element name="the_geom"
                        type="gml:GeometryPropertyType" />
                    <xs:element name="nestedFeature"
                        type="ex:ConnectionUsageFirstNestedPropertyType" />
                </xs:sequence>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <xs:complexType name="ConnectionUsageFirstNestedType"
        xmlns:xs="http://www.w3.org/2001/XMLSchema">
        <xs:complexContent>
            <xs:extension base="gml:AbstractFeatureType">
                <xs:sequence>
                    <xs:element name="the_geom"
                        type="gml:GeometryPropertyType" />
                    <xs:element name="nestedFeature"
                        type="ex:ConnectionUsageSecondNestedPropertyType" />
                </xs:sequence>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <xs:complexType name="ConnectionUsageSecondNestedType"
        xmlns:xs="http://www.w3.org/2001/XMLSchema">
        <xs:complexContent>
            <xs:extension base="gml:AbstractFeatureType">
                <xs:sequence>
                    <xs:element name="the_geom"
                        type="gml:GeometryPropertyType" />
                    <xs:element name="conditionallyNestedFeature"
                        type="ex:ConnectionUsageThirdNestedPropertyType" />
                </xs:sequence>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <xs:complexType name="ConnectionUsageThirdNestedType"
        xmlns:xs="http://www.w3.org/2001/XMLSchema">
        <xs:complexContent>
            <xs:extension base="gml:AbstractFeatureType">
                <xs:sequence>
                    <xs:element name="the_geom"
                        type="gml:GeometryPropertyType" />
                </xs:sequence>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <xs:complexType name="ConnectionUsageFirstNestedPropertyType">
        <xs:sequence minOccurs="0">
            <xs:element ref="ex:ConnectionUsageFirstNested" />
        </xs:sequence>
        <xs:attributeGroup ref="gml:AssociationAttributeGroup" />
        <xs:attributeGroup ref="gml:OwnershipAttributeGroup" />
    </xs:complexType>

    <xs:complexType name="ConnectionUsageSecondNestedPropertyType">
        <xs:sequence minOccurs="0">
            <xs:element ref="ex:ConnectionUsageSecondNested" />
        </xs:sequence>
        <xs:attributeGroup ref="gml:AssociationAttributeGroup" />
        <xs:attributeGroup ref="gml:OwnershipAttributeGroup" />
    </xs:complexType>

    <xs:complexType name="ConnectionUsageThirdNestedPropertyType">
        <xs:sequence minOccurs="0">
            <xs:element ref="ex:ConnectionUsageThirdNested" />
        </xs:sequence>
        <xs:attributeGroup ref="gml:AssociationAttributeGroup" />
        <xs:attributeGroup ref="gml:OwnershipAttributeGroup" />
    </xs:complexType>

</xs:schema>
